#include "VGCVirtualGameConsole.h"

#include "CRectangleEntity.h"
#include "CTextEntity.h"
#include "CEntity.h"
#include "CRoom.h"
#include "CFrame.h"
#include "ShotEntity.h"
#include "Invader.h"
#include "Ship.h"
#include <vector>
#include <iostream>

using namespace std;

int VGCMain(const VGCStringVector &arguments) {

	// Create components
	CFrame *frame = new CFrame("Hello Object!", 640, 480);
	CRoom *room = new CRoom();

	CTextEntity *teText			= new CTextEntity("Hello, Object!", 64, 64);
	CRectangleEntity *teRect	= new CRectangleEntity(48, 80, 160, 20);
	ShotEntity *shot			= new ShotEntity(128, 256, 0.0);
	Invader *invader1			= new Invader(256, 256, 3.14159265 / 2, VGCClock::openTimer(6));
	Invader *invader2			= new Invader(300, 256, 3.14159265 / 2, VGCClock::openTimer(12));

	// Add components
	frame->addRoom(*room);

	room->addEntity(*teText);
	room->addEntity(*teRect);
	room->addEntity(*shot);
	room->addEntity(*invader1);
	room->addEntity(*invader2);
	//room.addEntity(Ship::instance());

	// Apply settings
	teText->setColor(VGCColor(255, 255, 0, 0));
	teRect->setColor(VGCColor(255, 0, 0, 255));

	// Run game
	frame->run();

	// Delete room and frame
	delete room;
	delete frame;

	// Terminate application
	return 0;
}

double lastTime = 0;